<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr =[10,22,18,89];

        console.log(Math.max(...arr));
        
        function max(){
            num = arr[0];
            for(let i=0;i<arr.length;i++){
                num = num < arr[i]?arr[i]:num;
            }
            return num;
        }
        console.log(max())

        console.log(arr.reduce((a,b)=>a+b));
        function add(){
            num = 0;
            for(let i=0;i<arr.length;i++){
                num += arr[i];
            }
            return num;
        }
        console.log(add())
    </script>
</body>
</html>